<%-- 
    Document   : uploadfilecontent
    Created on : Oct 29, 2011, 7:41:10 AM
    Author     : phathuynh
--%>

<%@page import="java.util.List"%>
<%@page import="hibernate.pojo.Loaisanpham"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Admin Zing Deal| Upload ảnh</title>
<script language="javascript">
    function kiemTra()
    {
        var thumuc = document.formUpload.cboLoaiSanPham.value;
        var fileupload = document.formUpload.file_upload.value;
        if(thumuc=="")
        {
                alert("Chọn thư mục chứa ảnh cần upload");
                document.formUpload.cboLoaiSanPham.focus();
                return false;
        }
        if(fileupload=="")
        {
                alert("Chưa chọn ảnh");
                document.formUpload.file_upload.focus();
                return false;
        }	
        return true;
    }
</script>

</head>

<body>
<div align="center">
  <form action="adminuploadfilecontroller?action=upload" method="post" enctype="multipart/form-data" name="formUpload" id="formUpload" onsubmit="return kiemTra();">
    <table width="" border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="center" bgcolor="#0066FF">STT</td>
            <td align="center" bgcolor="#0066FF">Link File</td>
            <td align="center" bgcolor="#0066FF">Chọn</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table>
        </td>
      </tr>
      <tr>
        <td>Chọn thư mục chứa ảnh</td>
        <td>
            <label>
              <select name="cboLoaiSanPham" id="cboLoaiSanPham">
                  <option value="">Chọn thư mục</option>
                    <%
                    Loaisanpham category = null;
                    List<Loaisanpham> arrLoaisanpham = (List<Loaisanpham>)request.getAttribute("DanhSachLoaiSanPham");
                    for(int i=0 ; i<arrLoaisanpham.size(); i++)
                    {
                        category = arrLoaisanpham.get(i);
                    %>
                    <option value="<%=i+1%>"> <%=category.getTenLoaiSanPham()%> </option>
                    <%
                        }
                    %>
                    <!--<option value="11">Customer</option>-->
                </select>
        </label>
        </td>
      </tr>  
      <tr>
        <td>Chọn ảnh</td>
        <td>
            <input type="file" name="file_upload" id="file_upload" /><br/>
            <input type="submit" name="button2" id="button2" value="Upload" />
        </td>
      </tr>
      
      <tr>
          <%
          String iLink = (String)request.getAttribute("insertedlink");
          %>
        <td>Link ảnh</td>
        <td><label>
                <input type="text" name="txt_linkanh" value="<%=iLink%>" id="txt_linkanh" style="width: 250px" />
          <!--<input type="submit" name="button" id="button" value="Chọn" /> -->
        </label></td>
      </tr>
    </table>
  </form>
</div>
</body>
</html>

